<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>LifeCycle</title>
    </head>
    <body>
        <div id="app">{{msg}}</div>
        <script src="my-vue.js"></script>
        <script>  
        var vm = new Vue({
            el:'#app',//渲染的位置 
            template:'<div id="app">{{age}}</div>',//渲染的内容
            data:{msg:'hello',age:'18'},
            beforeCreate(){
                console.log('beforeCreate',this.msg)
            },
            created(){
                console.log('created',this.msg)
            },
            beforeMount(){
                let element = document.getElementById('app');
                console.log('beforeMount',element.innerText)
            },
            mounted(){
                let element = document.getElementById('app');
                console.log('mounted',element.innerText)
            }
        });
        //如果Vue的参数对象中没有el,则会等待用户手工挂载vm.$mount
        //vm.$mount('#app');
        //当数据修改之后
        vm.msg = 'world';
    </script>
    </body>
</html>